import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    socketData1:{},
    socketData3:{},
  },
  getters: {
    socketData1: state => state.socketData1,
    socketData3: state => state.socketData3,
  },
  mutations: {
    setSocketData1(state, payload) {
      state.socketData1 = { ...state.socketData1, ...payload }; // 使用展开运算符合并对象
    },
    setSocketData3(state, payload) {
      state.socketData3 = { ...state.socketData3, ...payload }; // 使用展开运算符合并对象
    },
    Set_Name(state,name){
      state.name=name
    },
    Set_Depart(state,depart){
      state.depart=depart
    },
    Set_Role(state,role){
      state.role=role
    },
    Set_createDate(state,createDate){
      state.createDate=createDate
    },
    Set_userName(state,username){
      state.username=username
    },
    Set_Pass(state,password){
      state.password=password
    }
  },
  actions: {
    setName({commit},name){
      commit('Set_Name',name)
    },
    setDepart({commit},depart){
      commit('Set_Depart',depart)
    },
    setRole({commit},role){
      commit('Set_Role',role)
    },
    setcreateDate({commit},createDate){
      commit('Set_createDate',createDate)
    },
    setuserName({commit},username){
      commit('Set_userName',username)
    },
    setPass({commit},password){
      commit('Set_Pass',password)
    }
  },
  modules: {
  }
})
